package com.example.user.quartz;

import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;

public class TestJob {

    public static void main(String[] args) throws SchedulerException {
        JobDetail jobDetail = JobBuilder.newJob(MyJob.class)
                .withIdentity("job","group1")
                .usingJobData("job1","v1").build();

        Trigger trigger = TriggerBuilder.newTrigger().startNow().withSchedule
                (SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(2).repeatForever())
                .withIdentity("trigger","group1")
                .usingJobData("trigger1","vv1").build();

        Scheduler defaultScheduler = StdSchedulerFactory.getDefaultScheduler();
        defaultScheduler.scheduleJob(jobDetail,trigger);
        defaultScheduler.start();
    }
}
